Skip to main content

For Each File

AutomatR.DefaultActivities.FileAndFolder.ForEachFile

The "For Each File" activity in AutomatR enables users to perform a series of activities on each file within a specified folder. This activity streamlines file processing tasks, allowing for efficient automation workflows.

Properties

NameDescription
Input
Filter BySpecifies the desired file extension for filtering. For example, ".docx". String variables containing the file extension. Default is "*.*" (all files).
In FolderSpecifies the complete path for the folder on which you wish to perform operations. String variables containing the folder path.
Include SubfoldersIndicates whether to expand the search to include all subfolders of the selected location. Accepts Boolean values. Boolean variables or arguments.
Misc
Display NameProvides a customizable name for the activity displayed in the workflow. Enhances clarity and organization within the automation project. String variables containing the desired display name.
VariablesRepresents the index of the current iteration within the "For Each File" loop. Integer variables or arguments to store the index value.
Optional
DelaySpecifies the amount of time (in seconds) to wait before executing the "For Each File" activity. Useful for handling synchronization issues. Integer variables or arguments containing the delay duration. Example: If the amount of time is 1000 milliseconds or 1 sec, i.e., 1.

How to use:

  1. Drag and drop the "For Each File" activity onto the workflow.
  2. Configure the properties by specifying the folder path, file extension filter, and whether to include subfolders.
  3. Optionally, configure the delay and customize the display name.
  4. Define the series of activities to be performed on each file by adding activities within the Body container.
  5. Execute the workflow to iterate through each file in the specified folder and perform the defined actions.

Example: Consider an example where the "For Each File" activity is used to process all ".txt" files within the "D:\Data" directory:

For Each File:
Display Name: "Process Text Files"
In Folder: "D:\Data"
Filter By: ".txt"
Include Subfolders: True
Body:
- Read Text File
- Extract Data
- ...

In this example, the activity iterates through each ".txt" file in the "D:\Data" directory, executing a series of defined actions within the Body container for each file. Adjust the folder path, file extension filter, and actions as needed for your workflow.